<?php
/**
 * Formul�rio de remo��o de uma fonte.
*/

if( !function_exists('__autoload') )
{
    function __autoload($class_name) {
    require_once $class_name . '.php';
    }
}

SAEO::ValidarAcesso( array( 0, 2 ) );


$ano = new Ano();
$anosCadastrados = $ano->CarregarAnos();
?>
<html>
           <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
           <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
           <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
           <head>
           <title>SAEO - Remo&ccedil;&atilde;o de Fonte de Recurso</title>
           <script type='text/javascript' src='templates/hintbox.js'></script>
           <script type='text/javascript' src='templates/js.js'></script>
           <script type='text/javascript' src='templates/fonte.js'></script>
           <script type='text/javascript' src='templates/programa.js'></script>       
           <script type='text/javascript' src='templates/ajax.js'></script>
           <script type='text/javascript' src='templates/validacoes.js'></script>
           <link rel='stylesheet' type='text/css' href='templates/estilos.css'/>

           </head>
     <body class='body'onload='javascript: CarregarProgramas(document.remover_fonte.anoId.value ); document.cadastrar_fonte.fonteRecurso.focus();'>
     <form name='remover_fonte' action='EnviarDadosFonte.php?operacao=3' method='post'>
     <table width='779' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
            <tr>
                <td>
                <?php include "Topo.php"; ?>
                </td>
            </tr>
            <tr>
                <td><div class='titulosTabelas' style='width:779; height:20; background:url(templates/tabela.jpg)'>REMO&Ccedil;&Atilde;O DE FONTE</div></td>
            </tr>
            <tr>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td><table class='tabela' width='650' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
                           <tr>
                               <td colspan='2'>&nbsp;</td>
                           </tr>
                           <tr>
                               <td class='textoTabelas' width='30%'>&nbsp;Ano:</td>
                               <td class='textoTabelas'>
                                   <select name='anoId' id='anoId' class='inputTexto'  onchange='EsconderDiv(getElementById("informacaoFonte")); CarregarProgramas( this.value );' >
                                           <option value='0'>Selecione o Ano</option>
	                               			<?php
    		                           			$anoAtual = $ano->getAnoAtual(); 
					                            // Percorre o array anosCadastrados e cria options para cada posi��o.
			        		                    for ($i = 0; $i < count( $anosCadastrados ); $i++){
			                	            		$status = $anoAtual == $anosCadastrados[$i]->ano ? "selected" : "";
			                    	        		echo "<option value='".$anosCadastrados[$i]->id."' $status>".$anosCadastrados[$i]->ano."</option>";
			                        		    }
											?>
                                   </select>
                                   <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaAno ?>'>[?]</a>
                               </td>
                           </tr>
                           <tr>
                               <td colspan='2'>&nbsp;</td>
                           </tr>
                           <tr>
                               <td class='textoTabelas'>&nbsp;A&ccedil;&atilde;o Or&ccedil;ament&aacute;ria: </td>
                               <td class='textoTabelas'>
                               <select name='programas' id='listaProgramas' class='inputTexto' onchange='MostrarDiv ( this.value, getElementById("informacaoFonte")); CarregarCampoFonteRemov(this.value);' style="width: 300px;">
                                       <option id='programa' value='0'>Primeiro selecione primeiro o Ano</option>
                               </select>
                               <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaPrograma ?>'>[?]</a>
                               </td>
                           </tr>
                           <tr>
                               <td colspan='2'>&nbsp;</td>
                           </tr>
                            <tr>
                               <td colspan='4'>
                                   <div id='informacaoFonte' style='display:none;'>
                                               <table class='tabela' width='650' style='border-style: none' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
                                               		<tbody id="tbCampoFonteRemov">
                                               		</tbody>                                                      
                                                 	<tr>
                                                    	<td colspan='2' height='46'><div style='position:relative;left:540px'><input type='image' style='width:100px;height:30px;' src='templates/btremover.JPG'/></div></td>
                                                 	</tr>
                                               	</table>
                                   </div>
                               </td>
                           </tr>
                     </table>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
            </tr>
            <tfoot>
           <tr>
                <td colspan='2'>&nbsp;</td>
            </tr>
                   <tr>
                    <?php include 'rodapeCreditos.php'; ?>
            </tr>
            </tfoot>
     </table>
     </form>
     </body>
</html>
